module.exports = function ($scope, $state, $stateParams,$resource,$modal,FileUploader,toaster, items, flag, type, $modalInstance) {
    console.log(items);
    console.log(flag, type);
    var para = {};
    var url = '';
    $scope.info = {
        'title' : ''
    };
    $scope.ok = function(){
      if (type == '1' && flag == 'pass'){
        url = '/api/ac/ggc/reviewCompanyProjectService/updateLeaderUp';
        para = {
          'project_code' : items.project_code,
          'leader_message' : $scope.info.title
        }
      } else if (type == '1' && flag == 'reject'){
          url = '/api/ac/ggc/reviewCompanyProjectService/updateLeaderDown';
          para = {
            'project_code' : items.project_code,
            'leader_message' : $scope.info.title
          }
      } else if (type == '1' && flag == 'eliminate'){
          url = '/api/ac/ggc/reviewCompanyProjectService/updateLeaderBack';
          para = {
            'project_code' : items.project_code,
            'leader_message' : $scope.info.title
          }
      } else if (type == '2' && flag == 'pass'){
        url = '/api/ac/ggc/reviewCompanyProjectService/updateLeadersUp';
        para = {
          'project_code' : items.project_code,
          'leaders_message' : $scope.info.title
        }
      } else if (type == '2' && flag == 'reject'){
          url = '/api/ac/ggc/reviewCompanyProjectService/updateLeadersDown';
          para = {
            'project_code' : items.project_code,
            'leaders_message' : $scope.info.title
          }
      } else if (type == '2' && flag == 'eliminate'){
          url = '/api/ac/ggc/reviewCompanyProjectService/updateLeadersBack';
          para = {
            'project_code' : items.project_code,
            'leaders_message' : $scope.info.title
          }
      } 
      if (confirm('是否认定该审核状态,一经提交,无法更改!!!')){
        $resource(url, {}, {}).save(para, function(res){
            if(res.errcode != 0){   
                toaster.error({title:"",body:res.errmsg});
                return;
            }
            console.log(res);
            toaster.success({title:"",body:'操作成功'});
            $modalInstance.close();
        });
      }
    }
}  